Xbasic

IS_OBJECT Function

Syntax

Result_Flag as L = IS_OBJECT(C object name)

Result_Flag as L = IS_OBJECT(P object_pointer)

Arguments

object

The "name" of the object, as in " :customer:button1 ".

object_pointer

A pointer to the object.

Description

IS_OBJECT() returns .T. if Object_Pointer or Object_Address references a valid object. If you use IS_OBJECT() on a pointer variable without a value, the function will return FALSE (.F.).

Example

This Interactive Window session illustrates how IS_OBJECT() works with pointers.

dim ptr as P
? is_object(ptr)
= .F.
ptr = form.load("Inventory")
? is_object(ptr)
= .T.

The following command tests to see if a form called "customer" has a button called "Button1".

flag = is_object(":customer:button1")
'This does the same thing
p = obj(":customer:button1")
flag = IS_object(p)

This script opens a form named myform, but only if it is not already open.

if is_object("myform") then 
myform.show() 
myform.activate() 
else 
form.view("myform") 
end if

See Also